<?php

$i = 4221;

$n1 = intval($i/1000);
$n2 = intval($i/100)%10;
$n3 = intval($i/10)%10;
$n4= $i%10;

echo $n4.$n3.$n2.$n1;

echo "\n";
